package com.easyweb.entity;

// Generated May 29, 2009 4:16:57 PM by Hibernate Tools 3.2.4.GA

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Iller generated by hbm2java
 */
@Entity
@NamedQueries( {
	@NamedQuery(name = "illerTumKayitlar", query = "select i from Iller i   order by i.ilAdi") 
})
@Table 
public class Iller implements java.io.Serializable {

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	@Version
	@Column(name = "version")
	private Integer version;
	
	@Column(name = "ilAdi", nullable = false, length = 50)
	@NotNull(message="#{messages.errBosOlamaz}")
	@Length(max = 50,message="#{messages.errUzunlukElliGecemez}")
	private String ilAdi;
	
	@Column(name = "plakaKodu", nullable = false, length = 5)
	@NotNull
	@Length(max = 5)
	private String plakaKodu;
	
 
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="bolgeId")
	private Bolge bolge;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ulkeId")
	private Ulke ulke;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "iller")
	private List<Ilce> ilces;
	
	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "il")
	private List<Bayi> bayiler;
	
	 
	 	
	public Iller() {
	}
	
	 
 
	public Iller(String ilAdi, String plakaKodu,  Bolge bolge,
			Ulke ulke, List<Ilce> ilces) {
		super();
		this.ilAdi = ilAdi;
		this.plakaKodu = plakaKodu;
	 
		this.bolge = bolge;
		this.ulke = ulke;
		this.ilces = ilces;
	}



	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	
	public String getIlAdi() {
		return this.ilAdi;
	}

	public void setIlAdi(String ilAdi) {
		this.ilAdi = ilAdi;
	}

 
	public String getPlakaKodu() {
		return plakaKodu;
	}





	public void setPlakaKodu(String plakaKodu) {
		this.plakaKodu = plakaKodu;
	}





	public Bolge getBolge() {
		return bolge;
	}





	public void setBolge(Bolge bolge) {
		this.bolge = bolge;
	}





	public Ulke getUlke() {
		return ulke;
	}





	public void setUlke(Ulke ulke) {
		this.ulke = ulke;
	}

	public List<Ilce> getIlces() {
		return ilces;
	}

	public void setIlces(List<Ilce> ilces) {
		this.ilces = ilces;
	}



	public List<Bayi> getBayiler() {
		return bayiler;
	}



	public void setBayiler(List<Bayi> bayiler) {
		this.bayiler = bayiler;
	}

 

}
